﻿<UserControl x:Class="Gallery.MVVM.SimpleSample.SimpleExampleView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:apexMVVM="clr-namespace:Apex.MVVM;assembly=Apex.Silverlight"
             xmlns:apexControls="clr-namespace:Apex.Controls;assembly=Apex.Silverlight"
             xmlns:apexCommands="clr-namespace:Apex.Commands;assembly=Apex.Silverlight"
             xmlns:SimpleSample="clr-namespace:Gallery.MVVM.SimpleSample"
             xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" mc:Ignorable="d" 
             d:DesignHeight="400" d:DesignWidth="500">
    
    <!-- The View creates its own ViewModel, so set the ViewModel 
    to a new instance of the ViewModel class. -->
    <UserControl.DataContext>
        <SimpleSample:SimpleExampleViewModel x:Name="viewModel" />
    </UserControl.DataContext>
    
    <!-- The main grid. Holds the description and the sample. -->
    <apexControls:ApexGrid Columns="300,Auto,*" Rows="Auto,*">
            
        <!-- The description. -->
        <TextBlock Grid.Row="0" Grid.Column="0" Text="Description" FontSize="20" FontWeight="Light" />
        <TextBlock Grid.Row="1" Grid.Column="0" FontSize="12" FontFamily="Segoe UI">
            In this sample we have a ViewModel with three notifying properties - FirstName, SecondName and FullName. Each of the text 
            boxes are bound to one of these properties.
            We also have a command that builds the full name from the first and second 
            names
            This sample demonstrates ViewModel, NotifyingProperty and Command.
        </TextBlock>

        <!-- Splitter. -->
        <!--<sdk:GridSplitter Grid.Column="1" Grid.RowSpan="2" ResizeBehavior="PreviousAndNext" ResizeDirection="Columns" Width="5" /> -->
        <sdk:GridSplitter Grid.Column="1" Grid.RowSpan="2" Width="5" />
        
        <!-- The sample. -->
        <TextBlock Grid.Row="0" Grid.Column="2" Text="Sample" FontSize="20" FontWeight="Light" />
        
        <!-- The data entry grid. -->
        <apexControls:PaddedGrid Grid.Row="1" Grid.Column="2" Rows="Auto,Auto,Auto,Auto,Auto" Columns="150,*" Padding="4">
            
            <!-- The first name. -->
            <TextBlock Grid.Row="0" Grid.Column="0" Text="First Name" />
            <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding FirstName, UpdateSourceTrigger=PropertyChanged}" />
            <TextBlock Grid.Row="1" Grid.Column="0" Text="Second Name" />
            <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SecondName, UpdateSourceTrigger=PropertyChanged}" />
            <TextBlock Grid.Row="2" Grid.Column="0" Text="Full Name" />
            <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding FullName}" IsReadOnly="True" />
            <Button Grid.Row="3" Grid.Column="1" Width="80" Content="Build Name" Command="{Binding BuildNameCommand}" />
        </apexControls:PaddedGrid>

    </apexControls:ApexGrid>
</UserControl>
